package com.ruoyi.stock.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.stock.domain.QwEchnicalaspect;
import com.ruoyi.stock.service.IQwEchnicalaspectService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 技术分析Controller
 * 
 * @author ruoyi
 * @date 2023-08-16
 */
@RestController
@RequestMapping("/stock/echnicalaspect")
public class QwEchnicalaspectController extends BaseController
{
    @Autowired
    private IQwEchnicalaspectService qwEchnicalaspectService;

    /**
     * 查询技术分析列表
     */
    @PreAuthorize("@ss.hasPermi('stock:echnicalaspect:list')")
    @GetMapping("/list")
    public TableDataInfo list(QwEchnicalaspect qwEchnicalaspect)
    {
        startPage();
        List<QwEchnicalaspect> list = qwEchnicalaspectService.selectQwEchnicalaspectList(qwEchnicalaspect);
        return getDataTable(list);
    }

    /**
     * 导出技术分析列表
     */
    @PreAuthorize("@ss.hasPermi('stock:echnicalaspect:export')")
    @Log(title = "技术分析", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, QwEchnicalaspect qwEchnicalaspect)
    {
        List<QwEchnicalaspect> list = qwEchnicalaspectService.selectQwEchnicalaspectList(qwEchnicalaspect);
        ExcelUtil<QwEchnicalaspect> util = new ExcelUtil<QwEchnicalaspect>(QwEchnicalaspect.class);
        util.exportExcel(response, list, "技术分析数据");
    }

    /**
     * 获取技术分析详细信息
     */
    @PreAuthorize("@ss.hasPermi('stock:echnicalaspect:query')")
    @GetMapping(value = "/{echnicalaspectId}")
    public AjaxResult getInfo(@PathVariable("echnicalaspectId") Long echnicalaspectId)
    {
        return success(qwEchnicalaspectService.selectQwEchnicalaspectByEchnicalaspectId(echnicalaspectId));
    }

    /**
     * 新增技术分析
     */
    @PreAuthorize("@ss.hasPermi('stock:echnicalaspect:add')")
    @Log(title = "技术分析", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QwEchnicalaspect qwEchnicalaspect)
    {
        return toAjax(qwEchnicalaspectService.insertQwEchnicalaspect(qwEchnicalaspect));
    }

    /**
     * 修改技术分析
     */
    @PreAuthorize("@ss.hasPermi('stock:echnicalaspect:edit')")
    @Log(title = "技术分析", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QwEchnicalaspect qwEchnicalaspect)
    {
        return toAjax(qwEchnicalaspectService.updateQwEchnicalaspect(qwEchnicalaspect));
    }

    /**
     * 删除技术分析
     */
    @PreAuthorize("@ss.hasPermi('stock:echnicalaspect:remove')")
    @Log(title = "技术分析", businessType = BusinessType.DELETE)
	@DeleteMapping("/{echnicalaspectIds}")
    public AjaxResult remove(@PathVariable Long[] echnicalaspectIds)
    {
        return toAjax(qwEchnicalaspectService.deleteQwEchnicalaspectByEchnicalaspectIds(echnicalaspectIds));
    }
}
